/**
 * Created by dale on 2017/10/9.
 */
var privateCarList;
$(document).ready(function () {

    privateCarList = $('#privateCarList');
    $('.xh-datagrid-toolbar').parseToolbar();
    //1.申请列表  2.审批列表  3.审批通过
    var carPlate = addressUri.getParam('carPlate');
    privateCarList.initDataGrid(baseUrl + 'lm/car/getPrivateCar',{queryParams:getParams()});
    
    if(!carPlate){
        DataGrid.onDblClickRow = function (rowIndex,rowData) {
            var carPlate = rowData['sCarPlate'];
            window.top.xhTop.showModal({
                title:rowData['sCarOwner']+'私车记录',
                content:'<iframe src="'+baseUrl+'lm/car/privateCarList?carPlate='+escape(carPlate)+'" style="height: 550px;border-style: none;padding: 0px;width: 100%;"></iframe>',
                size:'lg',
                backClose: false
            });
        }
    }

    $('#bt_list_search').click(function () {
        privateCarList.addDataGridParams(getParams());
    });


});

function getParams() {
    var key=xhExtra.getValue($('#list_search'));
    var carPlate = addressUri.getParam('carPlate');
    if(carPlate != null){
        carPlate = unescape(carPlate);
    }
    return {key:key,carPlate:carPlate};
}

